package com.imay.live.view;

import android.content.Context;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.StyleRes;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

import com.imay.live.R;

/**
 * Created by Administrator on 2017/07/28 0028.
 */

public class DekaronFrameLayout extends FrameLayout {
    public DekaronFrameLayout(@NonNull Context context) {
        super(context);
    }

    public DekaronFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public DekaronFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public DekaronFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        View view = findViewById(R.id.view_top);
        if (view != null) {
            FrameLayout.LayoutParams params = (LayoutParams) view.getLayoutParams();
            params.height = getMeasuredHeight();
            view.setLayoutParams(params);
        }

    }
}
